package android.slc.extras.user.config;

import android.content.Context;
import android.slc.appbase.config.ConstantsBase;
import android.slc.appbase.vm.GlobalDataVm;
import android.slc.extras.user.repository.local.UserSp;

import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ActivityUtils;

/**
 * @author slc
 * @date 2020-06-19 15:21
 */
public class ConstantsUser extends ConstantsBase {
    public static class Key extends ConstantsBase.Key {
        public static final String KEY_USER_INFO = "userInfo";
        public static final String KEY_USER_INFO_LIST = "userInfoList";
        public static final String KEY_USER_ID = "userId";
        public static final String KEY_USER_IDS = "userIds";
        public static final String KEY_PHOTO_URI = "photoUri";
        public static final String KEY_UP_DATE = "upDateApp";

        //树选择适配器类型 部门
        public static final int KEY_ADAPTER_ITEM_TYPE_DEPT = 1;
        //树选择适配器类型 用户
        public static final int KEY_ADAPTER_ITEM_TYPE_USER = 2;

        public static final String KEY_LOGIN_ONLY_FINISH = "loginOnlyFinish";
    }

    public static class Value extends ConstantsBase.Value {

    }

    public static class Event extends ConstantsBase.Event {

    }

    public static class Path extends ConstantsBase.Path {
        public static final String PATH_USER_INFO = "/user/user_info_activity";
        public static final String PATH_LOGIN = "/user/login_activity";
        public static final String PATH_UP_DATA_ACTIVITY = "/user/up_data_activity";
        public static final String PATH_LOCAL_SERVICE = "/user/local_service";
    }

    public static void outLogin(Context context) {
        UserSp.setAutoLogin(false);
        ActivityUtils.finishAllActivities();
        GlobalDataVm.getInstance().clearAllData();
        ARouter.getInstance().build(ConstantsUser.Path.PATH_LOGIN).navigation(context);
    }
}